/*
 * @Copyright: (C) 2019 Zhang Rida. All rights reserved.
 *
 * @Author: Zhang Rida
 * @Email: 215154317@qq.com
 * @FilePath: \WEILA_8910_PROJECT\Third-party\weilasdk\src\wlosal\src\wl_inner.h
 * @Date: 2021-02-18 15:07:07
 * @Description: weila osal inner type
 *
 * @LastEditors: Zhang Rida
 * @LastEditTime: 2021-05-25 18:36:10
 */
#ifndef _WL_INNER_TYPES_H
#define _WL_INNER_TYPES_H

#include "wl_types.h"

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#define WL_MQ_MSG_NUM 50  //消息队列中最大消息个数

#define WL_MESSAGE_QUEUE_MSG_DATA_SIZE 128

typedef enum {
    WL_TASK_MSG_NET = 0,
    WL_TASK_MSG_TIMER  = 1,
    WL_TASK_MSG_DNS    = 2,
    WL_TASK_MSG_HTTP   = 3,
    WL_TASK_MSG_MODULE = 0x10
} WL_TASK_MSG_TYPE;

typedef struct {
    wl_int32 type;
    wl_int32 datalen;
    wl_char  data[WL_MESSAGE_QUEUE_MSG_DATA_SIZE];
} wl_task_message;

typedef struct {
    wl_int32 moduleid;  //消息接收模块id
    wl_int32 msgid;     //消息id
    wl_int32 datalen;   //消息长度
    void*    data;      //消息
} wl_module_message;

typedef wl_int32 (*wl_task_message_callback)(wl_task_message* message);

/**
 * @description: 发送task消息
 * @param taskid 接收taskid
 * @param message 消息
 * @return 成功 0 失败 -1
 */
wl_int32 wl_send_task_message(wl_int32 taskid, wl_task_message* message);

#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _WL_INNER_TYPES_H */
